<template>
  <div>
    <span>我是兄弟组件：</span>
    <el-input
        style="width: 200px; margin-right: 10px"
        v-model="brolocalMsg"
        clearable
        placeholder="请输入给子组件的内容"
    ></el-input>
    <el-button type="warning" @click="brosendData">给子组件传值</el-button>
    <hr/>
    <span>我是兄弟组件：</span>
    <el-input
        style="width: 200px; margin-right: 10px"
        v-model="brolocalMsg"
        clearable
        placeholder="用总线给子组件的传递"
    ></el-input>
    <el-button type="warning" @click="brobusSendData">给子组件传值</el-button>
  </div>
</template>

<script>
// import  EventBus  from '../main';
export default {
  name: 'broCom',
  data(){
    return{
      brolocalMsg:''
    }
  },
  methods: {
    brosendData () {
      this.$emit('brosendChild', this.brolocalMsg)
    },
    brobusSendData(){
      this.$bus.$emit('data-to-child-b', this.brolocalMsg);
    }
  }
}
</script>

<style>
div {
  margin: 0 0 10px 0;
}
</style>
